<template>
  <div class="counter">
    <Result :result="result"></Result>
    <Button con="-" type="JIAN"
            @dispatch="dispatch"
    ></Button>
    <Button con="+" type="JIA"
            @dispatch="dispatch"
    ></Button>
  </div>
</template>

<script>
  import dispatcher from "../../dispatchers/counter";

  import Result from "./Result.vue";
  import Button from "./Button.vue";
  export default {
      name:"Counter",
      components:{Result,Button},
      data(){
          return{
              result:0,
          }
      },
      methods:{
          dispatch(val){
              dispatcher(this)(val);
          }
      }
  }
</script>
